package com.immunology.database.transformers;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.log4j.Logger;

import com.immunology.core.BaseTransformer;
import com.immunology.database.DbColumns;
import com.immunology.model.ComplaintType;

public class ComplaintTypeTransformer extends BaseTransformer<ComplaintType> {
	private static final Logger LOG = Logger
			.getLogger(ComplaintTypeTransformer.class);

	@Override
	public ComplaintType transformTo(ResultSet resultSet) {
		ComplaintType complaintType = new ComplaintType();
		try {
			complaintType.setId(resultSet.getInt(DbColumns.FIRST_COLUMN));
			complaintType.setName(resultSet.getString(DbColumns.SECOND_COLUMN));
			complaintType.setMultyplier(resultSet.getDouble(DbColumns.THIRD_COLUMN));
			complaintType.setSyndromeId(resultSet.getInt(DbColumns.FOURTH_COLUMN));
		} catch (SQLException e) {
			LOG.error("Can't create ComplaintTypeTransformer object:", e);
		}
		return complaintType;
	}

}
